package com.amor.app

import com.amor.demo.web1.BuildConfig
import com.amor.util.WebViewHolder
import com.hy.frame.base.BaseApplication

/**
 * title MyApplication
 * author HeYan
 * date 2021/9/25
 * desc
 */
class MyApplication : BaseApplication() {

    override fun isLoggable(): Boolean = BuildConfig.DEBUG

    override fun initAttrs() {
        mApp = this
//        DataUtil.init(this)
//        SQLiteDatabase.loadLibs(this)
        initUM(true)
        super.initAttrs()
    }

    override fun initAppForMainProcess() {
        initRefreshStyle()
    }

    override fun initAppForOtherProcess(process: String?) {

    }

    /**
     * 初始化友盟
     */
    fun initUM(pre: Boolean = false) {

    }

    private fun initRefreshStyle() {

    }

    private var mWebViewHolder: WebViewHolder? = null
    fun getWebViewHolder(): WebViewHolder {
        if (mWebViewHolder == null) {
            mWebViewHolder = WebViewHolder(this)
        }
        return mWebViewHolder!!
    }

    companion object {
        private var mApp: MyApplication? = null

        //        private var mModel: AppViewModel? = null
        fun get(): MyApplication {
            return mApp!!
        }
//        fun getModel(): AppViewModel{
//            if (mModel == null){
//                mModel = ViewModelProvider.AndroidViewModelFactory.getInstance(mApp!!).create(AppViewModel::class.java)
//            }
//            return mModel!!
//        }


    }
}